-
Notifications
You must be signed in to change notification settings - Fork 2
NR filter and edit cuts and selections logic #372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
* Update HISTORY.md for version 1.6.1 changes * Bump version from 1.6.0 to 1.6.1 * Bump version to 1.6.1 * Bump version from 1.6.0 to 1.6.1 * Update PyPI publish action to use specific release * Upgrade pypa/gh-action-pypi-publish version Updated the version of the pypa/gh-action-pypi-publish action to v1.13.0. * Update PyPI publish action version
* Add elife to cs2 corrections * Update condition for cs2 and alt_cs2 assignment
* Bump version: 1.6.1 → 1.6.2 * Update HISTORY.md for version 1.6.2 * Update HISTORY.md to remove changelog link Removed the full changelog link from the HISTORY.md file.
Co-authored-by: Carlo Fuselli <cfuselli@nikhef.nl>
…G4 (#361) * Modified load_root_file for supporting multiple primary positions in G4 root files. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add elife to cs2 corrections (#368) * Add elife to cs2 corrections * Update condition for cs2 and alt_cs2 assignment * Release 1.6.2 (#369) * Bump version: 1.6.1 → 1.6.2 * Update HISTORY.md for version 1.6.2 * Update HISTORY.md to remove changelog link Removed the full changelog link from the HISTORY.md file. * Fix root input to accept both 1D primary per event and 2D * bump plugin version --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Saad el Morabit <selmorab@nikhef.nl> Co-authored-by: Carlo Fuselli <cfuselli@nikhef.nl> Co-authored-by: Minghao Liu <mhliu0001@sina.com>
* Added NR yields, updated defaut yields treatment * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix typo * Update test simulation config from sr1_dev to sr2_dev * Update simulation config file for microphysics context * env var in tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix precommit * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Carlo Fuselli <cfuselli@nikhef.nl>
* Make NR flag more flexible * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * bump plugin version * fix precommit --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Carlo Fuselli <cfuselli@nikhef.nl>
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request performs a comprehensive renaming of data kinds and function arguments from interactions_in_roi/delayed_interactions_in_roi to microphysics_summary/delayed_microphysics_summary across the fuse detector physics simulation framework. Additionally, it introduces significant architectural changes to the data pipeline, including moving yields calculation earlier in the processing chain and adding a new NR (Nuclear Recoil) event filtering capability.
Changes:
- Renamed
interactions_in_roitomicrophysics_summaryanddelayed_interactions_in_roitodelayed_microphysics_summarythroughout all plugins, function signatures, and data_kind declarations - Restructured the microphysics pipeline so that yields and electric field calculations occur on
clustered_interactions(before selection cuts) rather than after ROI filtering - Added NRCut plugin for filtering nuclear recoil events based on expected signal characteristics
- Added NRSimulation selection merger class that combines volume selection with NR-specific cuts
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
fuse/plugins/truth_information/surviving_clusters.py |
Updated data_kind and renamed compute method parameter from interactions_in_roi to microphysics_summary |
fuse/plugins/truth_information/peak_truth.py |
Updated compute method signature and internal variable references to use microphysics_summary |
fuse/plugins/truth_information/event_truth.py |
Updated compute method signature to use microphysics_summary parameter |
fuse/plugins/truth_information/cluster_tagging.py |
Updated data_kind and all method signatures and internal references |
fuse/plugins/micro_physics/yields.py |
Changed dependency from interactions_in_roi to clustered_interactions, moving yields calculation earlier in pipeline |
fuse/plugins/micro_physics/microphysics_summary.py |
Updated depends_on reference (contains critical bug - circular dependency) |
fuse/plugins/micro_physics/electric_field.py |
Changed to depend on and process clustered_interactions instead of interactions_in_roi |
fuse/plugins/micro_physics/cuts_and_selections/physics_cases.py |
Added new NRCut plugin with filter logic for nuclear recoil events |
fuse/plugins/micro_physics/cuts_and_selections/detector_volumes.py |
Added export decorator for VolumeSelection class |
fuse/plugins/micro_physics/cuts_and_selections/apply_selections.py |
Updated SelectionMerger to provide microphysics_summary and added NRSimulation class |
fuse/plugins/detector_physics/secondary_scintillation.py |
Updated data_kind mapping and compute method signature |
fuse/plugins/detector_physics/s1_photon_propagation.py |
Updated compute method parameter name |
fuse/plugins/detector_physics/s1_photon_hits.py |
Updated data_kind and compute method signature with all internal references |
fuse/plugins/detector_physics/electron_propagation.py |
Updated compute method signature and all position/field references |
fuse/plugins/detector_physics/electron_drift.py |
Updated data_kind and compute method with all internal variable references |
fuse/plugins/detector_physics/delayed_electrons/photo_ionization_electrons.py |
Updated data_kind, documentation, and compute method signature |
fuse/plugins/detector_physics/delayed_electrons/delayed_electrons_secondary_scintillation.py |
Updated data_kind mapping and method signatures |
fuse/plugins/detector_physics/delayed_electrons/delayed_electrons_s1photonhits.py |
Updated data_kind and compute method |
fuse/plugins/detector_physics/delayed_electrons/delayed_electrons_propagation.py |
Updated compute method signatures to pass renamed parameter to parent |
fuse/plugins/detector_physics/delayed_electrons/delayed_electrons_merger.py |
Updated data_kind for all merger plugins |
fuse/plugins/detector_physics/delayed_electrons/delayed_electrons_drift.py |
Updated data_kind and compute method signature |
fuse/plugins/detector_physics/csv_input.py |
Updated data_kind assignment |
fuse/common.py |
Updated color map key from interactions_in_roi to microphysics_summary |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fuse/plugins/micro_physics/cuts_and_selections/physics_cases.py
Outdated
Show resolved
Hide resolved
fuse/plugins/micro_physics/cuts_and_selections/physics_cases.py
Outdated
Show resolved
Hide resolved
fuse/plugins/micro_physics/cuts_and_selections/physics_cases.py
Outdated
Show resolved
Hide resolved
fuse/plugins/micro_physics/cuts_and_selections/physics_cases.py
Outdated
Show resolved
Hide resolved
This reverts commit 390a861.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| for event_i in event_ids: | ||
| start_index = vertex_i | ||
| max_photons = 0 | ||
| max_electrons = 0 | ||
| prompt_photons = 0 | ||
| number_of_nr_interactions = 0 | ||
| start_time = mps["time"][vertex_i] | ||
|
|
||
| for vertex_i in range(start_index, len(mps)): | ||
| vertex = mps[vertex_i] | ||
|
|
||
| _is_a_new_event = event_i < vertex["eventid"] | ||
| if _is_a_new_event: | ||
| # Next event starts break for loop and check next event | ||
| break |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filter_events function assumes that all vertices with the same eventid are contiguous in the input array (lines 150-156). However, the clustered_interactions data is sorted by time (as seen in merge_cluster.py and merge_lineage.py), not by eventid. If interactions from different events have overlapping times, they may not be grouped by eventid, causing this function to process events incorrectly. Consider either: 1) sorting the input by eventid before processing, or 2) documenting the assumption that events are time-separated, or 3) using a different algorithm that doesn't assume contiguous event groups (e.g., processing all vertices and building event-based masks separately).
fuse/plugins/micro_physics/cuts_and_selections/physics_cases.py
Outdated
Show resolved
Hide resolved
… vertex (#373) * Initial plan * Fix slice index bug to include last vertex when NR ROI check fails Co-authored-by: cfuselli <62354392+cfuselli@users.noreply.github.com> * Use explicit boolean flag for better code clarity Co-authored-by: cfuselli <62354392+cfuselli@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: cfuselli <62354392+cfuselli@users.noreply.github.com>
for more information, see https://pre-commit.ci
This pull request makes several significant improvements and refactors to the microphysics simulation plugins, with a focus on standardizing data dependencies, expanding the available selection and cut plugins, and improving modularity for future extensions. The main changes include switching plugin dependencies from
interactions_in_roitoclustered_interactions, adding a new NR (nuclear recoil) cut plugin and simulation class, and ensuring new fields (quanta_fields,electric_fields) are included in relevant summaries and outputs.Refactoring and Standardization of Plugin Dependencies:
ElectricField,NestYields,BBFYields) to depend onclustered_interactionsinstead ofinteractions_in_roi, and changed theirdata_kindaccordingly for consistency and future extensibility. [1] [2] [3] [4] [5] [6] [7]Enhancements to Selection and Cut Plugins:
NRCutplugin that filters the microphysics summary for valid nuclear recoil (NR) events, with configurable parameters for photon/electron yields and S1/S2 area thresholds.NRSimulationclass that applies the NR cut, expanding the simulation capabilities for NR event studies.Expansion of Data Fields in Summaries:
SelectionMergerplugin and related simulation classes to includequanta_fieldsandelectric_fieldsin their summaries, ensuring downstream analyses have access to these quantities. [1] [2] [3]General Plugin Improvements and Exports:
strax.exporter()and@exportdecorators to several plugins and files to improve discoverability and modularity, making it easier to extend or reuse these plugins. [1] [2]Other Notable Changes:
SelectionMergerplugin frominteractions_in_roitomicrophysics_summary, and renamed the output ofMicroPhysicsSummarytomicrophysics_summary_AHAfor clarity and consistency. [1] [2]